import random

class stringutils(object):
    
    # 获取随机字符串 - 可指定位数
    def getRandomStr(num):
        seed = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
        sa = []
        for i in range(num):
            sa.append(random.choice(seed))
        salt = ''.join(sa)
        return salt
    
    # 获取随机数字 - 可指定位数
    def getRandomNum(num):
        seed = "1234567890"
        sa = []
        for i in range(num):
            sa.append(random.choice(seed))
        salt = ''.join(sa)
        return salt